<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>
    img{width: 50px;height: 50px}
  </style>
</head>
<body>
<input type="text" placeholder="请输入数量">
<input type="button" value="帅哥" onclick="f(1)">
<input type="button" value="美女" onclick="f(2)">
<script>
  let i = document.querySelector("input");
  function f(x) {
      for (let j = 0; j < i.value; j++) {
          let imgName = x==1?"man.jpg":"woman.jpg";
          //创建图片标签
          let img = document.createElement("img");
          //设置图片的显示内容
          img.src = imgName;
          //添加图片标签到body里面
          document.body.append(img);
      }
  }
</script>
</body>
</html>